function setCookie(c_name,value,exdays)
{
    var exdate=new Date();
    exdate.setDate(exdate.getDate() + exdays);
    var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
    document.cookie=c_name + "=" + c_value;
}

function getCookie(c_name)
{
    var i,x,y,ARRcookies=document.cookie.split(";");
    for (i=0;i<ARRcookies.length;i++)
    {
        x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
        y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
        x=x.replace(/^\s+|\s+$/g,"");
        if (x==c_name)
        {
            return unescape(y);
        }
    }
}

function delCookie(name)
{
    if(name !== undefined){
        document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
    }
}


function shg_set_otherlogin (objInput){
    var objPub = {id:null,jqr:null,jsonData:null};
    if(typeof objInput == 'object' && objInput !=null){for(var i in objInput){objPub[i]=objInput[i]}}
    if(objPub.jqr == null){return false}

    var htmlLogin = null;

    //before login

    var popRobotBox  = objPub.jqr('#popRobotBox');
    var robotContent = objPub.jqr('#robotContent',popRobotBox);
    bindClose = function(){
        popRobotBox.find('#closeRobot').click(function(){
                popRobotBox.fadeOut();}
        )
    };

    if(objPub.jsonData!=null) {
        var username = objPub.jsonData.username;
        var user_id = objPub.jsonData.id;
		objPub.jqr("#login_home").html('<div class="loginAfter cf"><div class="shgCoin"><a href="http://cuukiem.soha.vn/payment" title="Nạp Thẻ" target="_blank" class="shgBtn"><span class="icute"></span></a></div><div class="shgGuide"><a href="http://cuukiem.soha.vn/huong-dan.html" class="shgBtn" title="Hướng Dẫn"><span class="icute"></span></a></div></div>');
        objPub.jqr(".bonusPoint").removeAttr("onclick");


        objPub.jqr(".bonusPoint").click(function(){


            posturl = baseUrl+'index.php?option=com_gameevent&controller=api&action=getSpoin';
                objPub.jqr.ajax({
                    type: "POST",
                    url: posturl,
                    dataType:'text',
                    success: function(html) {

                        robotContent.html('<div style="text-align: center;padding:5px 0px;">Số SPoint của bạn: '+html+'</div><div style="text-align: center;padding:5px 0px 0px;"><span id="closeRobot" style="cursor:pointer;color:#797979;">Đóng lại</span></div>');
                        popRobotBox.fadeIn();
                        bindClose();
                        return;
                    }
                });

        });
    }
    
    return false;
}